package com.org.Bibliotech;
import static org.hamcrest.CoreMatchers.*;

import org.junit.Test;

import static org.junit.Assert.*;

public class BookTest {

        private  Book book1 = new Book("Head First Java", "Kathy Sierra & Bert Bates", 2003);
        private Book book2 = new Book("Anna Karenina", "Leo Tolstoy", 1877);

    @Test
    public void testCreateBook(){


        assertTrue(book1.equals(new Book("Head First Java", "Kathy Sierra & Bert Bates", 2003)));
       assertFalse(book1.equals(book2));

    }

    @Test
    public void testGetAuthor(){

        assertEquals(book1.getAuthor(), "Kathy Sierra & Bert Bates");
        assertEquals(book2.getAuthor(), "Leo Tolstoy");
    }

    @Test
    public void testGetTitle(){

        assertEquals(book1.getTitle(), "Head First Java");
        assertEquals(book2.getTitle(), "Anna Karenina");
    }

    @Test
    public void TestGetPublicationDate(){

        assertEquals(book1.getPublicationYear(), 2003);
        assertEquals(book2.getPublicationYear(), 1877);
    }




    @Test
    public void testGetDetails(){

        String details = book2.getDetails();
        assertEquals(details, "Title: " + "Anna Karenina" +'\n' +
                "Author: " + "Leo Tolstoy" + '\n' +
                "Publication Year: " + 1877);

    }

}